package com.sd.repay.task.utils;

import com.sd.repay.pojo.ScheduleJob;
import org.quartz.DisallowConcurrentExecution;
import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;

/**
 * @author sd
 * @Description: 若一个方法一次执行不完下次轮转时则等待改方法执行完后才执行下一次操作，保证多个任务间不会同时执行.所以在多任务执行时最好加上
 * @date 2017年10月25日
 */
@DisallowConcurrentExecution
public class QuartzJobFactoryDisallowConcurrentExecution implements Job {

    public void execute(JobExecutionContext context) throws JobExecutionException {
        ScheduleJob scheduleJob = (ScheduleJob) context.getMergedJobDataMap().get("sdRepay");
        TaskUtils.invokMethod(scheduleJob);

    }
}